<?php 

function root(){
	return \Ebcms::root();
}

function config($name, $default=null){
	return \Ebcms::config($name, $default);
}

function block($name, $default=''){
	return \Ebcms::block($name, $default);
}

function real_url($file){
	return \Ebcms::real_url($file);
}

function url($path, $query=[]){
	return \mylib\Route::buildUrl($path, $query);
}

function plugin_url($path, $query=[], $type=0){
	return \Plugin::url($path, $query, $type);
}

function plugin_check($name){
	if ($cfg = \Plugin::plugins($name)) {
		if ($cfg['status']) {
			return true;
		}
	}
	return false;
}

function content_url($content){
	if (\Ebcms::config('url_type') == '2') {
		return \mylib\Route::buildUrl('/home/content/detail', [
			'channel_id' => $content['channel_id'],
			'id' => $content['name']?:$content['id']
		]);
	}else{
		return \mylib\Route::buildUrl('/home/content/detail', [
			'id' => $content['id']
		]);
	}
}